package com.example.design.pattern.behavior

/**
 *目的：解决很多if else的情况
优点：可以避免多重判断条件，扩展性好
缺点：类会增多
 **/

interface Layout {
    fun draw()
}

class Use {
    /*  before
        fun main() {
            if () {

            } else if () {

            } else {

            }
        }
    */

    //after 依赖倒置
    fun doSomething(layout: Layout) {
        layout.draw()
    }
}

class LinearLayout : Layout {
    override fun draw() {
        TODO("Not yet implemented")
    }

}

class FlexLayout : Layout {
    override fun draw() {
        TODO("Not yet implemented")
    }

}

class GridLayout : Layout {
    override fun draw() {
        TODO("Not yet implemented")
    }

}